<?php 
  if (!isset($_SESSION['ok']) || $_SESSION['ok'] != "yes") {
    header("Location: ./");
    exit();
  }
?>
<!doctype>
<html>
<head>
  <title>web-mail</title>
  <meta http-equiv=content-type content="text/html; charset=utf-8">
  <link href="../css/globle_v1.css" type="text/css" rel="stylesheet">
  <link href="../css/inbox.css" type="text/css" rel="stylesheet">
  <link href="../css/skin_blue.css" rel="stylesheet" type="text/css" id="lnkskin">

  <meta content="mshtml 6.00.6000.16809" name="generator">
  <style>
    body {min-width: 1000px;}
    .ibx_td_date, .ibx_th_date {
        width: 150px!important;
    }
    .txt a {
        margin: 0 5px;

        text-decoration: none;
    }
    input{
        background:none;
        border-style: none;
        color:#00629F;
        vertical-align:middle;
    }  
  </style>
</head>
<body class="all_c_page inbox">
  <form id="recive_message" name="recive_message" action="" method="post">
    <input id="oformaction" type="hidden">
    <div class="contentwp">
      <div class="contentthemewp">
        <div class="gtitle"> &nbsp; 
            <b class="mtt"><?= $now;?></b>&nbsp;&nbsp;(共&nbsp; <b class="fnt_red" id="ototalunread"><?= $count;?></b>&nbsp;封邮件) &nbsp;&nbsp;
        </div>
        <div class="gtoolbar gtbrtop">
          <input class="btn btnnml" hidefocus type="submit" value="删除邮件" outclass="btn btnnml" overclass="btn btnhv" onclick="return del_forever();">
          <div class="extra">
            <span class="txt">
              <?php echo "";?>
            </span>
          </div>
        </div>
        <div class=ibx_main_wp>
          <table class="ibx_gtable f2img ibx_gtable_tt" id="otablehead">
            <tbody>
              <tr>
                <th class="ibx_th_f"></th>
                <th class="ibx_th_chkbx">
                  <input id="oformcheckall" name="selectall" type="checkbox" onclick="selectAll()"></th>
                <th class="ibx_th_icoinfo">
                  <b class="icoibx"></b>
                </th>
                <th class="ibx_th_from">邮件主题</th>
                
                <th class="ibx_th_subject">邮件摘要</th>
                <th class="ibx_th_date">收件人</th>
                <th class="ibx_th_date">时间</th>
              </tr>
              <tbody></tbody>
            </tbody>
          </table>
          <div class="ibx_lst_dwp dwpopen">
            <table class="ibx_gtable ibx_gtable_con" id="otablecount0" action="list">
              <tbody>
                <?php foreach ($mailList as $v): ?>
                    <tr class="i_mark0 i_unrd">
                      <td class="ibx_td_f">&nbsp;</td>
                      <td class="ibx_td_chkbx">
                        <input type="checkbox" value="<?php echo $v['id'];?>" name="checked[]" index="0">
                      </td>
                      <td class="ibx_td_icoinfo"><b class='icoibx' type='markread'></b>                      </td>
                      <td class="ibx_td_from"><a href="<?php echo "";?>"><?php echo $v['mailTitle'];?></a></td>
                      <td class="ibx_td_subject"><a href="<?php echo "";?>"><?php echo $v['mailContent'];?></a></td>
                      <td class="ibx_td_date"><?php echo $v['toWho'];?></td>
                      <td class="ibx_td_date"><?php echo $v['sendTime'];?></td>
                    </tr>
                <?php endforeach;?>
                <tbody></tbody>
              </tbody>
            </table>
          </div>
        </div>
        <div class="gtoolbar gtbrbtm">
          <div class="extra">
            <span class="txt">
              <?php echo "";?>
            </span>
          </div>
        </div>
      </div>
    </div>
  </form>
    <script type="text/javascript">
        function del_forever()
        {   
            var cbs = document.getElementsByTagName("input");  
            var b = false; 
            for(var i=0;i<cbs.length;i++){  
                if(cbs[i].type == "checkbox" && cbs[i].checked){  
                    b = true;  
                }  
            }  
            if(!b){  
                alert("请至少选择一封邮件");  
                return false;  
            } else {
                document.recive_message.action="delMails.php"; 
            }
        }

        function selectAll() 
        {
            var obj = document.getElementsByName('selectall');
            var cks = document.getElementsByTagName("input");
            var ckslen = cks.length;
            for(var i = 0; i < ckslen; i++) {
                if(cks[i].type == 'checkbox') {
                    cks[i].checked = obj[0].checked;
                }
            }
        }
    </script>
</body>
</html>